//! 常量大小定义
//!
//! 一些常用的大小定义
#![no_std]

/// 1
pub const SZ_1: usize = 0x00000001;
/// 2
pub const SZ_2: usize = 0x00000002;
/// 4
pub const SZ_4: usize = 0x00000004;
/// 8
pub const SZ_8: usize = 0x00000008;
/// 16
pub const SZ_16: usize = 0x00000010;
/// 32
pub const SZ_32: usize = 0x00000020;
/// 64
pub const SZ_64: usize = 0x00000040;
/// 128
pub const SZ_128: usize = 0x00000080;
/// 256
pub const SZ_256: usize = 0x00000100;
/// 512
pub const SZ_512: usize = 0x00000200;

/// 1K
pub const SZ_1K: usize = 0x00000400;
/// 2K
pub const SZ_2K: usize = 0x00000800;
/// 4K
pub const SZ_4K: usize = 0x00001000;
/// 8K
pub const SZ_8K: usize = 0x00002000;
/// 16K
pub const SZ_16K: usize = 0x00004000;
/// 32K
pub const SZ_32K: usize = 0x00008000;
/// 64K
pub const SZ_64K: usize = 0x00010000;
/// 128K
pub const SZ_128K: usize = 0x00020000;
/// 256K
pub const SZ_256K: usize = 0x00040000;
/// 512K
pub const SZ_512K: usize = 0x00080000;

/// 1M
pub const SZ_1M: usize = 0x00100000;
/// 2M
pub const SZ_2M: usize = 0x00200000;
/// 4M
pub const SZ_4M: usize = 0x00400000;
/// 8M
pub const SZ_8M: usize = 0x00800000;
/// 16M
pub const SZ_16M: usize = 0x01000000;
/// 32M
pub const SZ_32M: usize = 0x02000000;
/// 64M
pub const SZ_64M: usize = 0x04000000;
/// 128M
pub const SZ_128M: usize = 0x08000000;
/// 256M
pub const SZ_256M: usize = 0x10000000;
/// 512M
pub const SZ_512M: usize = 0x20000000;

/// 1G
pub const SZ_1G: usize = 0x40000000;
/// 2G
pub const SZ_2G: usize = 0x80000000;
/// 4G
pub const SZ_4G: usize = 0x100000000;

#[cfg(test)]
mod test {
    use super::*;

    #[test]
    fn test() {
        assert_eq!(SZ_1, 1);
        assert_eq!(SZ_2, 2);
        assert_eq!(SZ_4, 4);
        assert_eq!(SZ_8, 8);
        assert_eq!(SZ_16, 16);
        assert_eq!(SZ_32, 32);
        assert_eq!(SZ_64, 64);
        assert_eq!(SZ_128, 128);
        assert_eq!(SZ_256, 256);
        assert_eq!(SZ_512, 512);
        assert_eq!(SZ_1K, 1024);
        assert_eq!(SZ_2K, 2 * 1024);
        assert_eq!(SZ_4K, 4 * 1024);
        assert_eq!(SZ_8K, 8 * 1024);
        assert_eq!(SZ_16K, 16 * 1024);
        assert_eq!(SZ_32K, 32 * 1024);
        assert_eq!(SZ_64K, 64 * 1024);
        assert_eq!(SZ_128K, 128 * 1024);
        assert_eq!(SZ_256K, 256 * 1024);
        assert_eq!(SZ_512K, 512 * 1024);
        assert_eq!(SZ_1M, 1 * 1024 * 1024);
        assert_eq!(SZ_2M, 2 * 1024 * 1024);
        assert_eq!(SZ_4M, 4 * 1024 * 1024);
        assert_eq!(SZ_8M, 8 * 1024 * 1024);
        assert_eq!(SZ_16M, 16 * 1024 * 1024);
        assert_eq!(SZ_32M, 32 * 1024 * 1024);
        assert_eq!(SZ_64M, 64 * 1024 * 1024);
        assert_eq!(SZ_128M, 128 * 1024 * 1024);
        assert_eq!(SZ_256M, 256 * 1024 * 1024);
        assert_eq!(SZ_512M, 512 * 1024 * 1024);
        assert_eq!(SZ_1G, 1 * 1024 * 1024 * 1024);
        assert_eq!(SZ_2G, 2 * 1024 * 1024 * 1024);
        assert_eq!(SZ_4G, 4 * 1024 * 1024 * 1024);
    }
}
